package com.yx.fx.webApi.controller.sys.user;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yx.fx.sys.db.entity.SysUser;
import com.yx.fx.sys.db.mapper.SysUserMapper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

@RestController
@RequestMapping("/sys/user")
public class SysUserController {

    @Resource
    private SysUserMapper sysUserMapper;

    /**
     * 1.获取网点的管户列表，用来重新给企业分配管户经理
     * @param bankId
     * @return
     */
    @GetMapping("/getSysUserList/{bankId}")
    public List<SysUser> getMarketingUsers(@PathVariable String bankId){
        QueryWrapper<SysUser> sysUserQueryWrapper = new QueryWrapper<>();
        sysUserQueryWrapper.eq("bank_id",Long.valueOf(bankId));
        List<SysUser> sysUserList = sysUserMapper.selectList(sysUserQueryWrapper);
        System.out.println("sysUserList="+sysUserList);
                                                                                                                                                                                                                                                                                                                                                                                                   return sysUserList;
    }

    @PostMapping("/getSysUserList")
    public List<SysUser> getSysUserList(@RequestBody @Valid String bankId){
        QueryWrapper<SysUser> sysUserQueryWrapper = new QueryWrapper<>();
        sysUserQueryWrapper.eq("bank_id",Long.valueOf(bankId));
        List<SysUser> sysUserList = sysUserMapper.selectList(sysUserQueryWrapper);
        System.out.println("sysUserList="+sysUserList);
        return sysUserList;
    }
}
